Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 18: Controlling Texture Mapping

../ch18/18fig19b.gif
Figure 18.19b

A square face texture mapped using texture coordinates to select the texture image.

18fig19b.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Shape {
    appearance Appearance {
        material Material { }
        texture ImageTexture {
            url "testimg.jpg"
        }
    }
    geometry IndexedFaceSet {
        coord Coordinate {
            point [
                -1.0 -1.0 0.0,
                 1.0 -1.0 0.0,
                 1.0  1.0 0.0,
                -1.0  1.0 0.0,
            ]
        }
        coordIndex [ 0, 1, 2, 3, ]
        texCoord TextureCoordinate {
            point [
                0.2 0.2,
                0.8 0.2,
                0.8 0.8,
                0.2 0.8,
            ]
        }
        texCoordIndex [ 0, 1, 2, 3, ]
        solid FALSE
    }
}